package com.itnoob.demo3;

/**
 * @author zhoujun
 * @date 2025/3/26 21:06
 */
public class TestVisitorPattern {
    public static void main(String[] args) {

        Product book = new Product(100, "书籍");
        ProductInfoVo productInfoVo = new ProductInfoVo();
        productInfoVo.setProduct(book);

        //创建访问者对象 折扣和积分
        DiscountVisitor discountVisitor = new DiscountVisitor(0.8);
        PointVisitor pointVisitor = new PointVisitor(0.2);

        book.accept(discountVisitor);
        book.accept(pointVisitor);

    }
}
